<?php
if(!defined('IN_MANU')) { die('[ERROR] You cannot load this page directly !!!'); }

Class IndexController Extends baseController {

	/**
	 * default action
	 * 
	 * @param string $id
	 */
    public function index($id = null) 
    {
        $userName  = $this->registry->db->get('userManager')->getCurrentUser();
        
        /* if(!$user){
        	header('Location: ' . MANU_PATH . '/login');
        } */
    	    	
    	/* $userType = $user->get('type');
    	$userName = $user->get('username'); */
        $userType = 'Admin';
        //$userName = 'test';
        
    	if($userType == 'Admin')
    	{
    		$tags = array(	'manuContentTitle' => 'Welcome Administrator !',
    						'username' => $userName);
    	}
    	else 
    		$tags = array('manuContentTitle' => 'Welcome ' . $userName . ' !',
        				'username' => $userName);
        					
        $content = <<<EOT
Welcome to Administration Control Panel !<br /><br />
EOT;
		
		//if(!$user)	exit();
        $tags['path'] = MANU_ROOT_PATH . 'user';
        $tags['manuMessage'] = '';
       /* if (isset($_SESSION['message'])) {
        	$tags['manuMessage'] = ($_SESSION['message'] == 'success') ? $tem->getModule('sucmess', $tags) : $tem->getModule('errmess', $tags);
        	unset($_SESSION['message']);
        }
        else {
        	$tags['manuMessage'] = '';
        }*/
        
        $output = $this->registry->template->getPageContent('index', 'MANUSER Administrator CP', $content, $tags);
         
        echo $output;
    }  
}
?>
